package com.example.demo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.entity.Author;
import com.example.demo.mapper.AuthorMapper;
import com.example.demo.service.AuthorService;
import com.example.demo.util.PageUtil;

@Service
public class AuthorServiceImpl implements AuthorService {

  @Autowired
  private AuthorMapper authorMapper;

  @Override
  public boolean add(Author author) {
    return authorMapper.add(author) > 0;
  }

  @Override
  public boolean update(Author author) {
    return authorMapper.update(author) > 0;
  }

  @Override
  public boolean delete(int id) {
    return authorMapper.delete(id) > 0;
  }

  @Override
  public Author[] get(PageUtil pageUtil) {
    return authorMapper.get(pageUtil);
  }

  @Override
  public Author[] getAll() {
    return authorMapper.getAll();
  }

  @Override
  public Author[] findByName(String name, PageUtil pageUtil) {
    return authorMapper.findByName(name, pageUtil);
  }

  @Override
  public int findByNameCount(String name) {
    return authorMapper.findByNameCount(name);
  }

}
